import multiprocessing as mp
import time

def job(v,num):
    # l.acquire()  #加锁
    for _ in range(10):
        time.sleep(0.1)
        v.value += num  # v.value 获取v的数据
        print(v.value)
    # l.release() #释放

def mulit():
    # l = mp.Lock() # 定义进程锁
    v = mp.Value('i',0)  # 定义全局变量 共享数据
    m1 = mp.Process(target=job,args=(v,1))  # 传入变量 数据 锁
    m2 = mp.Process(target=job,args=(v,3))
    m1.start()
    m2.start()
    m1.join()
    m2.join()
if __name__ == '__main__':
    mulit()